<!DOCTYPE html>
<html>
  <head>
    <title>登录</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">


    <link rel="stylesheet" href="__STATIC__/mobile/css/weui.min.css">
    <link rel="stylesheet" href="__STATIC__/mobile/css/jquery-weui.css">
    <link rel="stylesheet" href="__STATIC__/mobile/css/demos.css">
    <link rel="stylesheet" href="__STATIC__/mobile/css/main.css">
  </head>

  <body ontouchstart>
    <div class="top-logo">
      <img src="__STATIC__/mobile/images/logo1.jpg" alt="">
    </div>
    <div class="weui-cells weui-cells_form">
      
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
        <div class="weui-cell__bd">
          <input id="phone" class="weui-input" type="tel" placeholder="请输入手机号">
        </div>
      </div>


      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">密码</label></div>
        <div class="weui-cell__bd">
          <input id="passwd" class="weui-input" type="password" placeholder="请输入密码">
        </div>
      </div>


    </div>
    
    <div class="weui-btn-area">
      <a class="weui-btn weui-btn_primary" href="javascript:" id="login">登录</a>
    </div>
    <!--
   <div class="login-change">
      <a href="register.html" class="register-btn left">快速注册?</a>
      <a href="forget.html" class="forget-btn right">忘记密码?</a>
    </div>
    -->
    <script src="__STATIC__/mobile/js/jquery-2.1.4.js"></script>
    <script src="__STATIC__/mobile/js/fastclick.js"></script>
    <script src="__STATIC__/mobile/js/globalvariable.js"></script>
    <script src="__STATIC__/mobile/js/sose.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script>
      $(function() {
        FastClick.attach(document.body);

        $('#login').click(function(){
            var phone = $("#phone").val();
            var password = $("#passwd").val();
            if (!isPhone(phone) || isNull(phone)) {
                $.toast("请填写正确手机号码","text");
                return false;
            }else if (isNull(password)) {
                $.toast("密码不能为空","text");
                return false;
            }else {
                $.post("http://house.wechatpic.com/Mobile/Login/checkpwd",{phone:phone,password:password},function(res){
                        if(res.val == 0){
                            $.toast("登录成功","text");
                            //console.log(res);return false;
                            location.href = res.url;
                            //window.close();
                        }else{
                            $.toast("账号或密码有误,请重试","text");return false;
                        }
                })
            }
        })
      });
    </script>
    <script src="__STATIC__/mobile/js/jquery-weui.js"></script>
    <script type="text/javascript" src="__STATIC__/mobile/js/aes.js"></script>
    <script type="text/javascript" src="__STATIC__/mobile/js/mode-ecb.js"></script>
    <script>
        
        function Encrypt(word){
           var key = CryptoJS.enc.Utf8.parse("yciiAESkey123456"); 
           var srcs = CryptoJS.enc.Utf8.parse(word);
           var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
           console.log(encrypted.toString());
               return encrypted.toString();
        }
        function Decrypt(word){
           var key = CryptoJS.enc.Utf8.parse("yciiAESkey123456"); 
           var decrypt = CryptoJS.AES.decrypt(word, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
           return CryptoJS.enc.Utf8.stringify(decrypt).toString();
        }
        function login(phone, password) {
            var obj = {
              'phone': phone,
              'passwd': password
            };
            doPost("account/passwdLogin.web", obj, function(data) {
                if (data.success) {
                    window.localStorage.mid = data.reModel.mId;
                    window.location.href="job-list.html?id="+data.reModel.mId;
                } else {
                    $.toast(data.errMsg,"text");
                }
            }, function(data) {
                  $.toast(data.errMsg,"text");
            });
          }   
    </script>
  </body>
</html>
